import request from "@/utils/request";
import type { formData, loginResponseData, emailFormData } from "./type";
// 请求地址
enum API {
    LOGIN_URL = '/api/user/login',
    LOGOUT_URL = '/api/user/logout',
    REG_URL = '/api/user/register',
    CODE_URL = '/api/user/register/get-Captcha'
}
export const reqLogin = (data: formData) => request.post<any, loginResponseData>(API.LOGIN_URL, data)
export const reqLogout = (username: string) => request.delete<any, any>(API.LOGOUT_URL + `?username=${username}`)
export const reqEmailReg = (data: emailFormData) => request.post<any, any>(API.REG_URL, data)
export const reqGetCode = (email: string) => request.get<any, any>(API.CODE_URL + `?email=${email}`)